#include "implementationbutton.h"

ImplementationButton::ImplementationButton(QGraphicsObject *parent) : AssociationButton(parent)
{
    QMatrix m;
    m.rotate(90);
    m.scale(.4, .6);

    this->_decorator.setPen(this->_pen);
    this->_decorator.setPolygon( m.map(GeneralizationDeocrator()));
    this->_decorator.setPos(10, 2);
    this->addToGroup(&this->_decorator);

    QVector<qreal> dashPattern;
    dashPattern << 2 << 2;
    QPen pen(this->_pen);
    pen.setDashPattern(dashPattern);
    this->_lineGraphicsItem.setPen(pen);

}

ImplementationButton::~ImplementationButton()
{
    qDebug() << "deleting implementation button";
}

DraggedRelation* ImplementationButton::draggedRelation()
{
    DraggedRelation *draggedRelation = new DraggedRelation();
    draggedRelation->setStartItem(this->_relationalItem);
    draggedRelation->setDecorator(GeneralizationDeocrator());

    UmlRelation *relation = new UmlRelation(UmlRelation::UmlRealizationRelationType);

    draggedRelation->setRelation(relation);

    return draggedRelation;
}
